From 3679c60f52c2dd0dd797269f7fcf61ffab8a64dd Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Thu, 7 Dec 2006 11:46:07 +0000 Subject: [PATCH] [LIBXC] Python error extraction tweak. Signed-off-by: Keir Fraser --- tools/python/xen/lowlevel/xc/xc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index be02bf8ed8..e74a882fe0 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -46,7 +46,10 @@ static PyObject *pyxc_error_to_exception(void) const xc_error const *err = xc_get_last_error(); const char *desc = xc_error_code_to_desc(err->code); - if (err->message[1]) + if (err->code == XC_ERROR_NONE) + return PyErr_SetFromErrno(xc_error_obj); + + if (err->message[0] != '\0') pyerr = Py_BuildValue("(iss)", err->code, desc, err->message); else pyerr = Py_BuildValue("(is)", err->code, desc); -- 2.30.2